<template>
  <div id="app">
    <ul>
      <li :key="item.id" v-for="item in list">
        <input type="checkbox" />
        {{ item.id }} - {{ item.name }}
        <button @click="del(item.id)">删除</button>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      list: [
        { id: 2, name: '宋江' },
        { id: 3, name: '吴用' },
        { id: 5, name: '林冲' },
        { id: 7, name: '花荣' },
        { id: 8, name: '鲁达' },
        { id: 9, name: '武松' }
      ]
    }
  },
  methods: {
    del(id) {
      this.list = this.list.filter(item => item.id != id)
    }
  }
}
</script>
